<?php if( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>update workday</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE type=text/css>
{
FONT-SIZE
:
 
12
px


}
.gridView {
	BORDER-RIGHT: #bad6ec 1px;
	BORDER-TOP: #bad6ec 1px;
	BORDER-LEFT: #bad6ec 1px;
	COLOR: #566984;
	BORDER-BOTTOM: #bad6ec 1px;
	FONT-FAMILY: Courier New
}

.gridViewHeader {
	BORDER-RIGHT: #bad6ec 1px solid;
	BORDER-TOP: #bad6ec 1px solid;
	BACKGROUND-IMAGE: url(<?php echo base_url(); ?> images /bg_th.gif);
	BORDER-LEFT: #bad6ec 1px solid;
	LINE-HEIGHT: 27px;
	BORDER-BOTTOM: #bad6ec 1px solid
}

.gridViewItem {
	BORDER-RIGHT: #bad6ec 1px solid;
	BORDER-TOP: #bad6ec 1px solid;
	BORDER-LEFT: #bad6ec 1px solid;
	LINE-HEIGHT: 32px;
	BORDER-BOTTOM: #bad6ec 1px solid;
	TEXT-ALIGN: center
}

.gridViewItemLeft {
	BORDER-RIGHT: #bad6ec 1px solid;
	BORDER-TOP: #bad6ec 1px solid;
	BORDER-LEFT: #bad6ec 1px solid;
	LINE-HEIGHT: 32px;
	BORDER-BOTTOM: #bad6ec 1px solid;
	TEXT-ALIGN: left
}

.gridViewItemRight {
	BORDER-RIGHT: #bad6ec 1px solid;
	BORDER-TOP: #bad6ec 1px solid;
	BORDER-LEFT: #bad6ec 1px solid;
	LINE-HEIGHT: 32px;
	BORDER-BOTTOM: #bad6ec 1px solid;
	TEXT-ALIGN: right
}

.cmdField {
	BORDER-RIGHT: 0px;
	BORDER-TOP: 0px;
	BACKGROUND-IMAGE: url(<?php echo base_url(); ?> images
	/bg_rectbtn.png);
	OVERFLOW: hidden;
	BORDER-LEFT: 0px;
	WIDTH: 67px;
	COLOR: #364c6d;
	LINE-HEIGHT: 27px;
	BORDER-BOTTOM: 0px;
	BACKGROUND-REPEAT: repeat-x;
	HEIGHT: 27px;
	BACKGROUND-COLOR: transparent;
	TEXT-DECORATION: none
}

.buttonBlue {
	BORDER-RIGHT: 0px;
	BORDER-TOP: 0px;
	BACKGROUND-IMAGE: url(<?php echo base_url(); ?> images
	/bg_button_blue.gif);
	BORDER-LEFT: 0px;
	WIDTH: 78px;
	COLOR: white;
	BORDER-BOTTOM: 0px;
	BACKGROUND-REPEAT: no-repeat;
	HEIGHT: 21px
}
</STYLE>
<META content="MSHTML 6.00.2900.5848" name=GENERATOR>
<script type="text/javascript" src="<?php echo base_url(); ?>js/calendar.js"></script>
</HEAD>
<?php
$empId = $this->uri->segment(3);
?>
<BODY style="BACKGROUND-POSITION-Y: -120px; BACKGROUND-IMAGE: url(<?php echo base_url(); ?>images/bg.gif); BACKGROUND-REPEAT: repeat-x">
	<DIV>
		<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
			<TBODY>
				<TR 
      	style="BACKGROUND-IMAGE: url(<?php echo base_url(); ?>/images/bg_header.gif); BACKGROUND-REPEAT: repeat-x" 
      		height=47>
					<TD width=10><SPAN 
        	style="FLOAT: left; BACKGROUND-IMAGE: url(<?php echo base_url(); ?>images/main_hl.gif); WIDTH: 15px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 47px"></SPAN></TD>
					<TD><SPAN 
        	style="FLOAT: left; BACKGROUND-IMAGE: url(<?php echo base_url(); ?>images/main_hl2.gif); WIDTH: 15px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 47px"></SPAN><SPAN 
        	style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FLOAT: left; BACKGROUND-IMAGE: url(<?php echo base_url(); ?>images/main_hb.gif); PADDING-BOTTOM: 10px; COLOR: white; PADDING-TOP: 10px; BACKGROUND-REPEAT: repeat-x; HEIGHT: 47px; TEXT-ALIGN: center; 0px: ">Staff Work Days</SPAN> <SPAN style="FLOAT: left; BACKGROUND-IMAGE: url(<?php echo base_url(); ?>images/main_hr.gif); WIDTH: 60px; BACKGROUND-REPEAT: no-repeat; HEIGHT: 47px"></SPAN></TD>
					<TD 
        	style="BACKGROUND-POSITION: 50% bottom; BACKGROUND-IMAGE: url(<?php echo base_url(); ?>images/main_rc.gif)" 
        	width=10></TD>
				</TR>
				<TR>
					<TD style="BACKGROUND-IMAGE: url(<?php echo base_url(); ?>images/main_ls.gif)">&nbsp;</TD>
					<TD style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; COLOR: #566984; PADDING-TOP: 10px; BACKGROUND-COLOR: white" vAlign=top align=left>
						<DIV>
							<TABLE class=gridView id=ctl00_ContentPlaceHolder2_GridView1 style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellSpacing=0 rules=all border=1>
								<TBODY>
									<TR>

										<TH class=gridViewHeader scope=col>EmployeID</TH>
										<TH class=gridViewHeader scope=col>Workday</TH>
										<TH class=gridViewHeader scope=col>Shour</TH>
										<TH class=gridViewHeader scope=col>Sminute</TH>
										<TH class=gridViewHeader scope=col>Ehour</TH>
										<TH class=gridviewHeader scope=col>Eminute</TH>
										<TH class=gridviewHeader scope=col></TH>
									</TR>

									<?php
									$num = 0;
									foreach($query->result() as $row ):
									if($row!=null){
										?>
									<TR>
										<form name="fm" action="<?php echo base_url(); ?>/workDayControl/doUpdate" method="post">
											<input type="hidden" name="id" value="<?=$row->id?>" /> <input type="hidden" name="workday" value="<?=$row->workday?>" />
											<TD class=gridViewItem><input type="text" readOnly name="employeid" value="<?=$row->employeid?>" /></TD>
											<TD class=gridViewItem><input type="text" readOnly name="showday" value="" /></TD>
											<TD class=gridViewItem><input type="text" name="shour" value="<?=$row->shour?>" /></TD>
											<TD class=gridViewItem><input type="text" name="sminute" value="<?=$row->sminute?>" /></TD>
											<TD class=gridViewItem><input type="text" name="ehour" value="<?=$row->ehour?>" /></TD>
											<TD class=gridViewItem><input type="text" name="eminute" value="<?=$row->eminute?>" /></TD>
											<TD class=gridViewItem><?php echo anchor('workDayControl/delete/'.$row->id,'delete')?></TD>
										</form>
									</TR>
									<?php
									$num++;
									}
									endforeach ?>

									<TR>
										<form name="fm" action="<?php echo base_url(); ?>/workDayControl/doAdd" method="post">
											<input type="hidden" name="workday" value="" />
											<TD class=gridViewItem><input type="text" readOnly name="employeid" value="<?php echo $empId;?>" /></TD>
											<TD><select name="workday">
													<option value="0" selected>sunday</option>
													<option value="1">monday</option>
													<option value="2">tuesday</option>
													<option value="3">wednesday</option>
													<option value="4">thursday</option>
													<option value="5">friday</option>
													<option value="6">saturday</option>
											</select></TD>
											<TD class=gridViewItem><input type="text" name="shour" value="" /></TD>
											<TD class=gridViewItem><input type="text" name="sminute" value="" /></TD>
											<TD class=gridViewItem><input type="text" name="ehour" value="" /></TD>
											<TD class=gridViewItem><input type="text" name="eminute" value="" /></TD>
											<TD class=gridViewItem><input type=submit value="Add" />
											</TD>
										</form>
									</TR>

								</TBODY>
							</TABLE>
						</DIV>
					</TD>
				</TR>
		
		</TABLE>
	</DIV>
</BODY>
</HTML>
<script type="text/javascript" language="javascript">
	var ck = document.getElementsByName("ckBox");
	var fm = document.getElementsByName("fm");
	for(var n=0;n<7;n++){
		if(fm[n].showday){
			var nu = fm[n].workday.value;
			fm[n].showday.value = changeShow(nu);
		}
	}
	function changeShow(value){
		var v = "sunday";
		if(value == 1){
			v = "monday";
		}
		if(value == 2){
			v = "tuesday";
		}
		if(value == 3){
			v = "wednesday";
		}
		if(value == 4){
			v = "thursday";
		}
		if(value == 5){
			v = "friday";
		}
		if(value == 6){
			v = "saturday";
		}
		return v;
	}
	function holdtime(){
		document.getElementById("lastfm").submit();
	}
	function setWorkday(va,value){
		fm[va].workday.value = value;
	}
	function doSubmit(){
		for(var i=0;i<ck.length;i++){
			if(ck[i].checked){
//				alert(i+"--"+fm[i].action);
				setTimeout("",500);
				fm[i].submit();
			}
		}
		setTimeout(holdtime,1000);
		holdtime();
	}
</script>




